<template>
    <el-table id="test" :max-height="tableHeight" :data="tableData" :header-cell-style="headerStyle" :cell-style="cellStyle" border style="width: 100%; background-color: #daecf8">
      <el-table-column prop="productNumber" label="产品编码" width="150" />
      <el-table-column prop="model" label="产品型号" width="180" />
      <el-table-column prop="productName" label="产品名称" />
      <el-table-column prop="state" label="状态" width="150"/>
      <el-table-column prop="version" label="版本" width="120"/>
    </el-table>
    <Loading :loading="loading" absolute="true" :tip="loadingText"/>
</template>
<script lang="ts">
import * as API from "@/api/pbi/offering";
import {endLoading, getHeaderStyle, getTableCellStyle, startLoading} from "@/utils";
import { ElLoading } from 'element-plus'
import { Loading } from '/@/components/Loading';
export default {
  name: 'OfferingProductList',
  components: {Loading},
  props: [],
  data() {
    return {
      loading: true,
      loadingText: '数据正在加载中...',
      headerStyle: getHeaderStyle(),
      cellStyle: getTableCellStyle(),
      tableData : []
    };
  },
  created() {
    // this.findTableData();
  },
  computed: {
    tableHeight(){
      let size = window.innerHeight - 220;
      console.log("scroll高度");
      console.log(size);
      return size;
    }
  },
  methods: {
    async findTableData(pbiNumber) {
      this.tableData = [];
      // startLoading("#test")
      this.loading = true;
      try {
        const res = await API.getOfferingProduct({pbinumber: pbiNumber});
        if (res && res.success === 'true') {
          this.tableData = JSON.parse(res.data)
        }
      } finally {
        this.loading=false;
        // endLoading();
      }
    }
  }
};
</script>



